package com.qen.compress

import cn.hutool.core.io.FileUtil
import cn.hutool.core.util.CharsetUtil
import cn.hutool.extra.compress.CompressUtil
import org.apache.commons.compress.archivers.ArchiveStreamFactory

fun main() {
    val file = FileUtil.file("/Users/a1/Documents/Git/Kotlin/Eleven/file/test.7z")
    CompressUtil.createArchiver(
        CharsetUtil.CHARSET_UTF_8,
        ArchiveStreamFactory.SEVEN_Z,
        file
    ).add(FileUtil.file("/Users/a1/Documents/Git/Kotlin/Eleven/file/index.html"))
        .finish()
        .close()


    val extractor = CompressUtil.createExtractor(
        CharsetUtil.defaultCharset(),
        FileUtil.file("/Users/a1/Documents/Git/Kotlin/Eleven/file/test.7z")
    )
    extractor.extract(FileUtil.file("/Users/a1/Documents/Git/Kotlin/Eleven/file/test/"))

}